package com.arlin.springcloud.controller;

import com.arlin.springcloud.pojo.Dept;
import com.arlin.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @ClassName: DeptConsumerController
 * @Description: TODO
 * @Author: arlin
 * @Date: 2021/3/21
 */
@RestController
public class DeptConsumerController {

    private final DeptClientService deptClientService;

    public DeptConsumerController(DeptClientService deptClientService) {
        this.deptClientService = deptClientService;
    }

    @RequestMapping("/consumer/dept/add")
    public boolean addDept(Dept dept) {
        return deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return deptClientService.get(id);
    }

    @RequestMapping("/consumer/dept/list")
    public List<Dept> getAll() {
        return deptClientService.getAll();
    }

}
